var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2BulletMgr = require("BulletMgr");
var $2KDefine = require("KDefine");
var $2Zombie = require("Zombie");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_Zombie3 = /* */function (_o$default2) {
  babel_inherits(c, _o$default2);
  var _super105 = babel_createSuper(c);
  function c() {
    var _this246;
    babel_classCallCheck(this, c);
    _this246 = _super105.apply(this, arguments);
    _this246.skinID = 1;
    _this246.ani = {
      move: "zou10",
      attack: "kenyao10",
      dead: "die"
    };
    return _this246;
  }
  babel_createClass(c, [{
    key: "time",
    get() {
      return this._time;
    },
    set(e) {
      this._time = e;
      this.dragon.timeScale = this.time;
      0 != this.time || this.skinID;
    }
  }, {
    key: "equipHp",
    get() {
      return this._equipHp;
    },
    set(e) {
      var _this247 = this;
      e < 0 && (e = 0);
      this._equipHp = e;
      if (this.equipHp / this.allequipHp < .75 && this.equipHp / this.allequipHp >= .5 && 2 != this.skinID) {
        this.skinID = 2;
      } else if (this.equipHp / this.allequipHp < .5 && this.equipHp / this.allequipHp >= .25 && 3 != this.skinID) {
        this.skinID = 3;
      } else if (this.equipHp / this.allequipHp < .25 && this.equipHp / this.allequipHp >= 0 && 4 != this.skinID) {
        this.skinID = 4, this.dragon.setCompleteListener(function () {
          _this247.dragon.setAnimation(0, "zou", true);
        }), this.dragon.setAnimation(0, "diaoluo", false);
      }
    }
  }, {
    key: "daiji",
    value: function daiji() {
      this.dragon.setAnimation(0, "zou10", true);
    }
  }, {
    key: "show",
    value: function show(e, t, a) {
      var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
      this.skinID = 1;
      babel_get(babel_getPrototypeOf(c.prototype), "show", this).call(this, e, t, a, n);
    }
  }, {
    key: "hurt",
    value: function hurt(e, t, a) {
      var n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
      var o = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
      var l = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
      if (this.inUse) {
        if ("" != t && t) {
          var _e133 = $2BulletMgr.default.instance().getEffect(t);
          _e133.scale = a;
          _e133.parent = this.node;
          _e133.x = n;
          _e133.y = o;
          var _s18 = _e133.getComponent(sp.Skeleton);
          _s18.setAnimation(0, "newAnimation", false);
          _s18.setCompleteListener(function () {
            _s18.setCompleteListener(null);
            _e133.scale = 1;
            $2BulletMgr.default.instance().removeEffect(_e133);
          });
        }
        if (this.equipHp > 0 && !l) {
          if (this.equipHp >= e) {
            this.equipHp -= e;
          } else {
            this.hp -= e - this.equipHp;
            this.equipHp = 0;
          }
        } else {
          this.hp -= e;
        }
        if (this.hp <= 0) {
          this.equipHp = 0;
          this.setState($2KDefine.State.dead);
        } else {
          this.flash = .7;
        }
      }
    }
  }, {
    key: "moveAni",
    value: function moveAni() {
      if (this.skinID < 4) {
        this.dragon.setAnimation(0, this.ani.move, true);
      } else {
        this.dragon.setAnimation(0, "zou", true);
      }
    }
  }, {
    key: "attackAni",
    value: function attackAni() {
      if (this.skinID < 4) {
        this.dragon.setAnimation(0, this.ani.attack, true);
      } else {
        this.dragon.setAnimation(0, "kenyao", true);
      }
    }
  }]);
  return c;
}($2Zombie.default);
def_Zombie3 = cc__decorate([ccp_ccclass], def_Zombie3);
exports.default = def_Zombie3;